import { createApp } from 'vue'

//引入全局变量
import "./assets/css/var.css"
//引入全局样式
import "./assets/css/common.css"

import router from './router'

//引入ant design vue
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/reset.css';
import * as Icon from '@ant-design/icons-vue';
//引入路由守卫
import './router/routeGuard.js'

import App from './App.vue'
const app = createApp(App)
window['rootVm'] = app ;
import { createPinia } from 'pinia'
app.use(createPinia())
//引入base-lib 里的组件
import baseControl,{I18Parse,layer,VueBus,MessageBox,VxeTable} from '@lowcode/jpaas-base-lib';
import '@lowcode/jpaas-base-lib/lib/style.css'
app.use(baseControl);
//vxe-table
import {VxeTooltip, VxeLoading} from 'vxe-pc-ui'
app.use(VxeTable).use(VxeTooltip).use(VxeLoading)
//引入自定义图标并挂载 iconfont ;
import '@public/iconfontSvg/line/iconfont.js'
import '@public/iconfontSvg/fill/iconfont.js'
import '@public/iconfontSvg/color/iconfont.js'

import * as iconfont from '@public/iconfont/iconfont.js'
import { createFromIconfontCN } from '@ant-design/icons-vue';
const MyIcon = createFromIconfontCN({
    scriptUrl: iconfont
});
app.component('my-icon',MyIcon);
//引入自定义图标并挂载 iconfont end;
//引入列表扩展组件
import expandRow from "@/views/modules/form/expandRow";
app.use(expandRow);

//引入share-component里的组件
import shareControl from '@lowcode/jpaas-share-component';
import '@lowcode/jpaas-share-component/lib/style.css'
app.use(shareControl);

import uploader from 'vue-simple-uploader';
app.use(uploader);

app.use(router)
app.use(Antd)
app.use(layer)
//全局注入Ant design 图标;
for (let key in Icon){
    app.component(key,Icon[key])
}
//语言包
import i18n from './language'
app.use(i18n);
import dayjs from "dayjs";
app.config.globalProperties.dayjs = dayjs;
app.config.globalProperties.$t=i18n.global.t;
//国际化语言解析
app.use(I18Parse);
//bus
app.config.globalProperties.$msg=MessageBox;
app.config.globalProperties.$bus=VueBus;
app.config.globalProperties.$baseUrl = import.meta.env.JPAAS_BASE_URL;
/**
 * 引入图表
 */
import * as Echarts from 'echarts'
app.config.globalProperties.$echarts = Echarts;

//拖拽表单
import'@lowcode/jpaas-form-lib/lib/style.css'
import XFormBuild from '@lowcode/jpaas-form-lib'
app.use(XFormBuild)

// 引入gridLayout
import VueGridLayout from 'vue-grid-layout'
app.use(VueGridLayout)

import rxFullcalendar from '@lowcode/rx-fullcalendar'
import '@lowcode/rx-fullcalendar/lib/style.css'
app.use(rxFullcalendar)

import Storage from 'vue-ls';
import VueLsOptions from "@/assets/js/storage.js";

app.use(Storage, VueLsOptions);

/*富文本*/
import VueUeditorWrap from 'vue-ueditor-wrap';
app.use(VueUeditorWrap);

import mavonEditor from 'mavon-editor';
import 'mavon-editor/dist/css/index.css';
app.use(mavonEditor);

window.app=app;
app.mount('#app')

// 卸载应用
window.unmount = () => {
    window.app = null ;
    app.unmount();
}

